home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 November / CHIP Kasım 1997.iso / ARACLAR / TER500 / 500TER._XE / SCRIPT.EXE / DEMO.TSL < prev    next >
Encoding:
Text File  |  1997-07-25  |  13.4 KB  |  416 lines

  1.  
  2. % -----------------------------------------------------------------------------
  3. % Main PreScription Demonstration Script               *TERMINATE PRESCRIPTION*
  4. % -----------------------------------------------------------------------------
  5. %
  6. %  Version          : 1.00
  7. %  Filename         : DEMO.TSL
  8. %  Company          : SerWiz Comm
  9. %  Programmer       : The Serial Wizard
  10. %  Module created   : 06 Aug 1995
  11. %  Latest revision  : 25 Jul 1997
  12. %  Language/version : Terminate Prescription 1.00
  13. %  Remarks          : Demonstrates most functions of the script language
  14. %
  15. % -----------------------------------------------------------------------------
  16.  
  17. Include demo.inc
  18.  
  19. Set Menus=11
  20. Set MenuLine=1
  21. Set MenuHead=30
  22. Set MenuText=7
  23. Set MenuTextHigh=3
  24. Set MenuTextBold=14
  25. Set Edit=11
  26. Set MenuBar=113
  27.  
  28. Cursor 0
  29. SetAttr 3
  30. ClearScreen
  31.  
  32. Stars(0)
  33.  
  34. SetAttr 3
  35. WriteStr 1, 1,"▄▄▄▄▄▄▄"
  36. WriteStr 1, 2,"░      ▀▄"
  37. WriteStr 1, 3,"▀▀▀█▀▀▄  █ ┌──────┐ ┌─────┐                          PreScription"
  38. WriteStr 1, 4,"░  █▀▀  ▄▀ │ ┌──┐ │ │ ┌───┘                          ────────────"
  39. WriteStr 1, 5,"▒  █▄▄▄▀   │ └──┘ │ │ └─┐   ┌────┐        The Script Language for Terminate"
  40. WriteStr 1, 6,"▓  █       │ ┌─┐ ┌┘ │ ┌─┘   └────┘           that will cure your problem"
  41. WriteStr 1, 7,"█  █       │ │ │ └┐ │ └───┐"
  42. WriteStr 1, 8,"▀▀▀▀       └─┘ └──┘ └─────┘                          Version 1.00"
  43. AttrBlock 1,8,80,8,11
  44. AttrBlock 54,3,66,3,14
  45. AttrBlock 54,4,66,4,1
  46. WriteStr 1, 9,"      ▄▄▄▄▄▄▄▄"
  47. WriteStr 1,10,"    ▄▀       █"
  48. WriteStr 1,11,"    ░    ░▀▀▀▀ ┌─────┐ ┌──────┐ ┌───┐ ┌─────┐ ┌─────┐ ┌───┐ ┌──────┐ ┌───┐  ┌─┐"
  49. WriteStr 1,12,"     ▀▄   ▀▄   │ ┌─┐ │ │ ┌──┐ │ └┐ ┌┘ │ ┌─┐ │ └─┐ ┌─┘ └┐ ┌┘ │ ┌──┐ │ │   └┐ │ │"
  50. WriteStr 1,13,"       ▀▀▄  ▀▄ │ │ └─┘ │ └──┘ │  │ │  │ └─┘ │   │ │    │ │  │ │  │ │ │ ├┐ └┐│ │"
  51. WriteStr 1,14,"    ▄▄▄▄▓    █ │ │ ┌─┐ │ ┌─┐ ┌┘  │ │  │ ┌───┘   │ │    │ │  │ │  │ │ │ │└┐ └┤ │"
  52. WriteStr 1,15,"    █       ▄▀ │ └─┘ │ │ │ │ └┐ ┌┘ └┐ │ │       │ │   ┌┘ └┐ │ └──┘ │ │ │ └┐   │"
  53. WriteStr 1,16,"    ▀▀▀▀▀▀▀▀   └─────┘ └─┘ └──┘ └───┘ └─┘       └─┘   └───┘ └──────┘ └─┘  └───┘"
  54. AttrBlock 1,16,80,16,11
  55. WriteAStr 30,19,11,"The Demonstration"
  56. WriteAStr 27,22,112," Press ENTER to begin. "
  57. WaitEnter
  58.  
  59. PopScreen(0)
  60.  
  61. ClearScreen
  62. Box 1,1,scrcol,4,113,6
  63. FillBlock 1,5,scrcol,scrlen-2,7,"▒"
  64. FillBlock 1,scrlen-1,scrcol,scrlen-1,1,"─"
  65. Set Header="TERMINATE PRESCRIPTION PROGRAMMING LANGUAGE"
  66. Set coldiv2=scrcol/2
  67. WriteAStr coldiv2-(Length(Header)/2)+1,2,MenuBar,Header
  68. WriteStr coldiv2-35,3,"Copyright (c) 1992,97 by Strathrory Systems Limited. All Rights Reserved"
  69. WriteAStr 2,6,112," Demonstration "
  70. WriteStr 2,7,"    Script     "
  71. WriteStr 2,8,"   DEMO.TSL    "
  72. Window coldiv2-17,6,coldiv2+18,21,3,1,Menus,MenuText,MenuHead," Script menu "
  73.  
  74. WriteAStr 2, 1,MenuText,"PreScription"
  75. WriteStr  2, 2,"What can a script do for me ?"
  76. WriteStr  2, 3,"Compiling scripts"
  77. WriteStr  2, 4,"Language syntax"
  78. WriteStr  2, 5,"Program structure"
  79. WriteStr  2, 6,"Expressions and operators"
  80. WriteStr  2, 7,"User defined functions"
  81. WriteStr  2, 8,"Statements"
  82. WriteStr  2, 9,"Loops"
  83. WriteStr  2,10,"Built-in functions"
  84. WriteStr  2,11,"Demonstrations"
  85. WriteStr  2,12,"Error messages"
  86. WriteStr  2,13,"Script examples"
  87. WriteStr  2,14,"Copyright information"
  88.  
  89. Set x=1
  90. Set y=1
  91. Set z=1
  92.  
  93. :Select
  94.  SetBarTxt  1,"What is the story behind PreScription"
  95.  SetBarTxt  2,"Why would I ever need a script ?"
  96.  SetBarTxt  3,"How do you compile scripts"
  97.  SetBarTxt  4,"What does the language look like"
  98.  SetBarTxt  5,"How does a program look like"
  99.  SetBarTxt  6,"Logical or not is the question"
  100.  SetBarTxt  7,"How do I make my own functions"
  101.  SetBarTxt  8,"You need to make a statement"
  102.  SetBarTxt  9,"Repeat Until, For Next, While EndWhile"
  103.  SetBarTxt 10,"How do I use the built-in functions and commands"
  104.  SetBarTxt 11,"See some interesting demonstrations"
  105.  SetBarTxt 12,"What does this error message mean"
  106.  SetBarTxt 13,"Some small script examples and description on how they work"
  107.  SetBarTxt 14,"As usual we need to mention this"
  108.  set x=selectbar(1,14,x,MenuBar,1,0,scrlen)
  109.  
  110.  If x=0
  111.   Goto End
  112.  Endif
  113.  If x=1
  114.   Gosub PreScription
  115.  Endif
  116.  If x=2
  117.   Gosub What4me
  118.  Endif
  119.  If x=3
  120.   Gosub Compile
  121.  Endif
  122.  If x=4
  123.   Gosub LanguageSyntax
  124.  Endif
  125.  If x=5
  126.   Gosub ProgramStructure
  127.  Endif
  128.  If x=6
  129.   Gosub ExpressionOperator
  130.  Endif
  131.  If x=7
  132.   Gosub ShowFunc
  133.  Endif
  134.  If x=8
  135.   Gosub Statements
  136.  Endif
  137.  If x=9
  138.   Gosub Loops
  139.  Endif
  140.  If x=10
  141.   Gosub BuiltIn
  142.  Endif
  143.  If x=11
  144.   Gosub CoolDemos
  145.  Endif
  146.  If x=12
  147.   Gosub ErrorMsg
  148.  Endif
  149.  If x=13
  150.   Gosub Examples
  151.  Endif
  152.  If x=14
  153.   Gosub Copyright
  154.  Endif
  155.  
  156.  Goto Select
  157.  
  158. :PreScription
  159.  Window coldiv2-38,6,coldiv2+38,22,3,1,Menus,MenuText,MenuHead," PreScription "
  160.  SetAttr 7
  161.  GotoXY 1,3
  162.  PrintLn " Many users had asked us to implement a basic script language for their"
  163.  PrintLn " communication needs. We realised that the need for such a capability was"
  164.  PrintLn " important since Terminate could not support everything in the"
  165.  PrintLn " communication world, so we decided to built a complete basic programming"
  166.  PrintLn " language, that would handle most of the functions a programmer would"
  167.  PrintLn " need."
  168.  PrintLn
  169.  PrintLn " PreScription is medicine and with a little programming experience, there"
  170.  PrintLn " is a good chance that it can cure your problem."
  171.  PrintLn
  172.  PrintLn " This demonstration script was made by Bo Bendtsen, SerWiz Comm"
  173.  WaitEnter
  174.  Removewindow
  175.  Return
  176.  
  177. :What4me
  178.  Window coldiv2-38,6,coldiv2+38,22,3,1,Menus,MenuText,MenuHead," Many things "
  179.  SetAttr 7
  180.  GotoXY 1,3
  181.  PrintLn " If you have a problem you need to get solved or automated, the script"
  182.  PrintLn " language is perfect. If you cannot program you can ask a programmer"
  183.  PrintLn " to help you. It can also be used for adding additional functions and"
  184.  PrintLn " features to Terminate and gives other programmers the opportunity"
  185.  PrintLn " to add things that we did not think of."
  186.  PrintLn
  187.  PrintLn " We have tried to make the language as simple as possible, but still"
  188.  PrintLn " allowing the programmers access to all the difficult functions in your"
  189.  PrintLn " PC, so the language would work both for beginners and experienced"
  190.  PrintLn " programmers. If you have any suggestions we are very interested in"
  191.  PrintLn " hearing from you as soon as possible."
  192.  WaitEnter
  193.  Removewindow
  194.  Return
  195.  
  196. :Compile
  197.  Window coldiv2-38,6,coldiv2+38,21,3,1,Menus,MenuText,MenuHead," Compiling scripts "
  198.  SetAttr 7
  199.  GotoXY 1,3
  200.  PrintLn " PreScription compiles the .TSL source files into .TSC compiled files"
  201.  PrintLn " and run the .TSC files. PreScription does not need the original source"
  202.  PrintLn " files, so you can make your programs and distribute without giving away"
  203.  PrintLn " all your knowledge."
  204.  PrintLn
  205.  PrintLn " If you make your own script and distribute, you are the copyright owner"
  206.  PrintLn " of the script and can decide under which conditions you want to release."
  207.  PrintLn " If you make a good script that you think is good enough to be included"
  208.  PrintLn " in Terminate, please send the .TSL file to the nearest registration site."
  209.  WaitEnter
  210.  Removewindow
  211.  Return
  212.  
  213. :LanguageSyntax
  214.  Window coldiv2-38,9,coldiv2+38,16,3,1,Menus,MenuText,MenuHead," Language syntax "
  215.  SetAttr 7
  216.  GotoXY 1,3
  217.  PrintLn " The syntax for PreScription is Pascal/Basic. You can read specific"
  218.  PrintLn " details on all the commands in the documentation."
  219.  WaitEnter
  220.  Removewindow
  221.  Return
  222.  
  223. :ProgramStructure
  224.  Window coldiv2-38,9,coldiv2+38,16,3,1,Menus,MenuText,MenuHead," Language syntax "
  225.  SetAttr 7
  226.  GotoXY 1,3
  227.  PrintLn " With PreScription you do not need to define or assign anything, you can"
  228.  PrintLn " start making your program right out of the box, without complicated setup."
  229.  WaitEnter
  230.  Removewindow
  231.  Return
  232.  
  233. :ExpressionOperator
  234.  Window coldiv2-38,6,coldiv2+38,20,3,1,Menus,MenuText,MenuHead," Expressions "
  235.  SetAttr 7
  236.  GotoXY 1,3
  237.  PrintLn " When programming you need expressions for evaluation purposes."
  238.  PrintLn " An expression contain operators, constants and variables."
  239.  PrintLn
  240.  PrintLn "   Apples        <- Variable"
  241.  PrintLn "   1000          <- Constant"
  242.  PrintLn "   +             <- Operator"
  243.  PrintLn
  244.  PrintLn "   Apples + 1000 <- Expression"
  245.  WaitEnter
  246.  Removewindow
  247.  Return
  248.  
  249. :ShowFunc
  250.  Window coldiv2-38,9,coldiv2+38,18,3,1,Menus,MenuText,MenuHead," Functions "
  251.  SetAttr 7
  252.  GotoXY 1,3
  253.  PrintLn " If you need other functions than the ones that are built-in in"
  254.  PrintLn " PreScription, you can define your own, which can be called from"
  255.  PrintLn " all over the script."
  256.  PrintLn " Instructions on how to create your own can be found in the documentation."
  257.  WaitEnter
  258.  Removewindow
  259.  Return
  260.  
  261. :Statements
  262.  Window coldiv2-38,7,coldiv2+38,18,3,1,Menus,MenuText,MenuHead," Statements "
  263.  SetAttr 7
  264.  GotoXY 1,3
  265.  PrintLn " Whenever you need to evaluate an expression you use a statement."
  266.  PrintLn " If Else Endif are the commands used for evaluation."
  267.  PrintLn
  268.  PrintLn " If Apples > 1000                    <- If Statement is true do! "
  269.  PrintLn "   Print Apples"
  270.  PrintLn " Endif"
  271.  WaitEnter
  272.  Removewindow
  273.  Return
  274.  
  275. :Loops
  276.  Window coldiv2-38,6,coldiv2+38,22,3,1,Menus,MenuText,MenuHead," Loops "
  277.  SetAttr 7
  278.  GotoXY 1,2
  279.  PrintLn " PreScription support 3 ways of looping."
  280.  PrintLn
  281.  SetAttr 14
  282.  PrintLn " For Next"
  283.  SetAttr 7
  284.  PrintLn
  285.  PrintLn "  Perform a loop a specific number of times"
  286.  PrintLn
  287.  SetAttr 14
  288.  PrintLn " Repeat Until"
  289.  SetAttr 7
  290.  PrintLn
  291.  PrintLn "  Continue looping until expression is true"
  292.  PrintLn
  293.  SetAttr 14
  294.  PrintLn " While Endwhile"
  295.  SetAttr 7
  296.  PrintLn
  297.  PrintLn "  Continue looping while expression is true"
  298.  Set Key=0
  299.  For Count,1,1000000,27
  300.    WriteAStr 60,2,11,Count
  301.    If Keypressed<>0
  302.     Set Key = GetKey
  303.     Set Count=1000000
  304.    Endif
  305.  Next
  306.  Removewindow
  307.  Return
  308.  
  309. :BuiltIn
  310.  Window coldiv2-38,9,coldiv2+38,17,3,1,Menus,MenuText,MenuHead," Built-in functions "
  311.  SetAttr 7
  312.  GotoXY 1,3
  313.  PrintLn " PreScription has many built-in functions which can be accessed from your"
  314.  PrintLn " script, but also many functions which accesses Terminate functions"
  315.  PrintLn " which gives you control over Terminate."
  316.  WaitEnter
  317.  Removewindow
  318.  Return
  319.  
  320. :CoolDemos
  321.  Window coldiv2-35,8,coldiv2-5,18,3,1,Menus,MenuText,MenuHead," Demonstration scripts "
  322.  WriteAStr 2, 1,MenuText,"Launch menu"
  323.  Repeat
  324.   SetBarTxt  1,"Start up external programs"
  325.   set y=selectbar(1,2,y,MenuBar,1,0,scrlen)
  326.   If y=1
  327.    Window coldiv2-25,10,coldiv2,20,3,1,Menus,MenuText,MenuHead," Launch menu "
  328.    WriteAStr 2, 1,MenuText,"Screen Blanker"
  329.    WriteStr 2, 2,"TerMail"
  330.    Repeat
  331.    SetBarTxt 1,"Run external screen blanker"
  332.    SetBarTxt 2,"Run external mail editor"
  333.    set z=selectbar(1,9,z,MenuBar,1,0,scrlen)
  334.    If z=1
  335.      Exec "UTILS\BLANKER.EXE !M"
  336.    Endif
  337.    If z=2
  338.      Exec "TERMAIL\TM.EXE !M"
  339.    Endif
  340.    If z>2
  341.      WriteStr 2,z,"Soon available"
  342.    Endif
  343.    Until z=0
  344.    RemoveWindow
  345.   Endif
  346.  Until y=0
  347.  Removewindow
  348.  Return
  349.  
  350. :ErrorMsg
  351.  Window coldiv2-38,9,coldiv2+38,18,3,1,Menus,MenuText,MenuHead," Error messages "
  352.  SetAttr 7
  353.  GotoXY 1,3
  354.  PrintLn " Whenever you are programming you will without a doubt make many errors"
  355.  PrintLn " that can make your program go into an endless loop or even hang your"
  356.  PrintLn " machine. PreScription will try and give you the best error code"
  357.  PrintLn " if an error should occur."
  358.  WaitEnter
  359.  Removewindow
  360.  Return
  361.  
  362. :Examples
  363.  Window coldiv2-38,6,coldiv2+38,22,3,1,Menus,MenuText,MenuHead," Example files "
  364.  SetAttr 7
  365.  PrintLn " To demonstrate to script in practice we included the following:"
  366.  PrintLn
  367.  PrintLn " DEMO.TSL       <- This demonstration script"
  368.  PrintLn " ATTR.TSL       <- Color example"
  369.  PrintLn " DATAFILE.TSL   <- Read from datafiles"
  370.  PrintLn " DUMPFILE.TSL   <- Dumps a file to screen"
  371.  PrintLn " ERRORMSG.TSL   <- Show all device messages"
  372.  PrintLn " MINITERM.TSL   <- Dumb terminal"
  373.  PrintLn " SHOWANSI.TSL   <- Show an ANSI file"
  374.  PrintLn " SHOWDIR.TSL    <- Show a directory"
  375.  PrintLn " SHOWKEY.TSL    <- A keyboard example"
  376.  PrintLn " SHOWTEXT.TSL   <- Show a textfile"
  377.  PrintLn " TEXTATTR.TSL   <- The color selector"
  378.  PrintLn " TIMER.TSL      <- Show how to use timers"
  379.  AttrBlock 2,3,13,14,14
  380.  WaitEnter
  381.  Removewindow
  382.  Return
  383.  
  384. :Copyright
  385.  Window coldiv2-38,2,coldiv2+38,22,3,1,Menus,MenuText,MenuHead," Copyright "
  386.  SetAttr 7
  387.  PrintLn "             Notice of COPYRIGHT and EXCLUSION OF LIABILITY"
  388.  PrintLn " Under local laws and according to the relevant international conventions,"
  389.  PrintLn " ALL versions of Terminate are copyright 1992,97 of Strathrory Systems Ltd."
  390.  PrintLn
  391.  PrintLn "                   Worldwide distributor SerWiz Comm"
  392.  PrintLn
  393.  PrintLn "                          All Rights Reserved."
  394.  PrintLn
  395.  PrintLn " IN NO EVENT WILL STRATHRORY SYSTEMS LIMITED, SERWIZ COMM OR ASSOCIATES BE"
  396.  PrintLn " LIABLE TO YOU FOR ADDITIONAL DAMAGES, INCLUDING ANY LOST PROFITS, LOST"
  397.  PrintLn " SAVINGS, OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE"
  398.  PrintLn " USE OR INABILITY TO USE PRESCRIPTION OR SCRIPTS FOR PRESCRIPTION, EVEN IF"
  399.  PrintLn " WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES."
  400.  PrintLn
  401.  PrintLn " Succinctly: By using this program, you agree not to hold Strathrory"
  402.  PrintLn " Systems Limited, SerWiz Comm or associates responsible for anything other"
  403.  Print " than taking up a lot of disk space."
  404.  WaitEnter
  405.  Removewindow
  406.  Return
  407.  
  408.  
  409.  
  410. :End
  411.  Removewindow
  412.  PopScreen(0)
  413.  ClearScreen
  414.  Cursor 1
  415.  
  416.